<template>
  <div>
    <!-- num: {{ value }} -->
    num: {{ abc }}
    msg: {{ a }}
    <button @click="addNum">num++</button>
    <button @click="setMsg">setMsg</button>
  </div>
</template>

<script>
export default {
  model: {
    prop: 'abc',
    event: 'cdf'
  },
  props: ['abc', 'a'],
  methods: {
    addNum() {
    //   let num = this.value
      let num = this.abc
      // let num = this.value + 1
      // let num = this.value++ // 不能这么写 this.value = this.value +1
      //   this.$emit('input', ++num)
      this.$emit('cdf', ++num)
    },
    setMsg() {
      this.$emit('update:a', '这是一条新闻呢！')
    }
  }
}
</script>

<style>

</style>
